package top.yifengxiner.common.utils;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.springframework.stereotype.Component;

/**
 * @author ：baixiao
 * @date ：Created in 2021/5/6 10:36
 * @description：shiro工具类
 * @modified By：
 * @version: 0.0.1$
 */
@Component
public class ShiroUtils
{
    /**
     * 生成随机盐
     * @return
     */
    public static String randomSalt()
    {
        // 一个Byte占两个字节，此处生成的3字节，字符串长度为6
        SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
        String hex = secureRandom.nextBytes(3).toHex();
        return hex;
    }
}
